<?php
if (!defined("_INDEX")) { header("Location: /"); die; }

$communities = UV::readMQ($route->GET("communities"));
$communities = explode(",",$communities);

$query = "select SUM(`guests`) as `guests`,SUM(`reviews`) as `reviews`,SUM(`comments`) as `comments` from `alex_report` where ";
for ($i = 0; $i < count($communities)-1; $i++)
{
	$query .= "`community_id` = '".$communities[$i]."'";
	if ($i < count($communities)-2)
		$query .= " or ";
}
$response = $db->getRow($query);

echo "{\"guests\":\"$response[guests]\",\"reviews\":\"$response[reviews]\",\"comments\":\"$response[comments]\"}";

?>